Unexpected end of file while searching for ']' to end attribute selector.

Posted by zurna on Stack Overflow See other posts from Stack Overflow or by zurna
Published on 2010-03-13T21:50:19Z Indexed on 2010/03/13 21:55 UTC
Read the original article Hit count: 373

Filed under:

I dont understand what would be the problem with the following code. It needs to copy image's id value to another textbox but instead I get an error.

Unexpected end of file while searching for ']' to end attribute selector.

<script>
$(function() { 
    $(".floatLeft").click(function() {
       var id = $(this).attr("id").replace(/\D/g, "");
       $("input[name='photo[" + id + "]'").val(Math.abs($("input[name='photo[" + id + "]'").val() - 1));
    });
});
</script>

      <ul class="thumbs">

        <li>
                <img src="/FLPM/media/news/images/2M9Y1I2K_sm.jpg" alt="Garden" id="28" class="floatLeft" />
                <input type="text" name="photo28" value="0" />

            <br />
            <a href="?Process=&IMAGEID=28" class="thumb"><span class="floatLeft">DELETE</span></a>
        </li>

        <li>
                <img src="/FLPM/media/news/images/2A9L1V2X_sm.jpg" alt="Frangipani Flowers" id="27" class="floatLeft" />
                <input type="text" name="photo27" value="0" />
            <br />
            <a href="?Process=&IMAGEID=27" class="thumb"><span class="floatLeft">DELETE</span></a>

        </li>
    </ul>

© Stack Overflow or respective owner

Related posts about jQuery